Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2180787) Dynamically calculate UEFI sections offset #63

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

pvalena
Copy link
Contributor

@pvalena pvalena commented Jun 27, 2023

  • fix(dracut.sh): use dynamically uefi's sections offset
  • fix(dracut.sh): handle imagebase for uefi

Resolves: #2180787

* Uefi section are creating by `objcopy` with hardcoded sections
offset. This commit allow to have the correct offset between
each part of the efi file, needed to create an UKI. Offsets
are simply calculated so no sections overlap, as recommended
in  https://wiki.archlinux.org/title/Unified_kernel_image#Manually
Moreover, efi stub file's header is parsed to apply the correct
offsets according the section alignment factor.
* Remove EFI_SECTION_VMA_INITRD, no need anymore as initrd
section offset dynamically calculated

Fixes dracutdevs#2275

Signed-off-by: Valentin Lefebvre <[email protected]>

(Cherry-picked commit: f32e95b)

Resolves: #2180787
* UEFI creation didn't handle the ImageBase data for the PE file
  generation. Create an UKI thanks a stub file with a non zero BaseImage
  logs some warning ans generate a bad file offset management. The efi
  becomes unloadable.
* This commit parse the PE file header, get the data and apply the
  ImageBase on the objcopy command.

Fixes dracutdevs#2284

Signed-off-by: Valentin Lefebvre <[email protected]>

(Cherry-picked commit: 6178a9d)

Related: #2180787
@pvalena pvalena self-assigned this Jun 27, 2023
dracut.sh Fixed Show fixed Hide fixed
strtonum is a gawkism and is not available in all awks, e.g. mawk. Use gawk
to avoid failure.

Fixes: f32e95b
Signed-off-by: Sam James <[email protected]>

(Cherry-picked commit: 33a66ed)

Related: #2180787
dracut.sh Dismissed Show dismissed Hide dismissed
@pvalena
Copy link
Contributor Author

pvalena commented Jul 23, 2023

Reported as dracutdevs/dracut#2440 - break line should not affect any behaviour though (not adding the fix). Added the patch, for gawk use instead of awk.

@pvalena
Copy link
Contributor Author

pvalena commented Jul 24, 2023

Tested in the Bug.

@pvalena pvalena merged commit 11cc703 into redhat-plumbers:main Jul 24, 2023
37 of 43 checks passed
@pvalena pvalena deleted the rhel-9-fix-2180787 branch July 24, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants